/**
 * @file demo83.c
 * @author WRS (1352509846@qq.com)
 * @brief 删除排序链表中的重复元素
 *        存在一个按升序排列的链表，给你这个链表的头结点head、请你
 *        删除所有的重复元素，使每个元素只出现一次
 *        返回：同样按升序排列的链表
 * @version 0.1
 * @date 2021-08-25
 * 
 * @copyright Copyright (c) 2021
 * 
 */

#include <stdio.h>

struct ListNode 
{
    int val;
    struct ListNode *next;
};

/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */
struct ListNode* deleteDuplicates(struct ListNode* head)
{
    if(head == NULL) return head;

    struct ListNode *cur = head;

    while(cur->next)
    {
        if(cur->val == cur->next->val)
        {
            cur->next = cur->next->next;
        }
        else
        {
            cur = cur->next;
        }
    }
    return head;
}

int main(int argc, char const *argv[])
{
    
    return 0;
}


